﻿@model IEnumerable<PeshoMVC.Models.UserProfileModel>
@using GridMvc.Html
@using PeshoMVC.MyHelpers
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "All user accounts";
}

<h2>All users</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@Html.Grid(Model).Columns(columns =>
                        {
                            columns.Add(model => model.UserName).Sortable(true);
                            columns.Add(model => model.Email).Sortable(true);
                            columns.Add(model => model.FirstName).Sortable(true);
                            columns.Add(model => model.LastName).Sortable(true);
                            columns.Add(model => model.Birthday).Format("{0:dd-MM-yyyy}").Sortable(true);
                            columns.Add(model => model.Gender).Sortable(true);
                            columns.Add(model => model.HaveAPet).Sortable(true);
                            columns.Add(model => model.PetName).Sortable(true);
                            columns.Add(model => model.PetGender).Sortable(true);
                            columns.Add(model => model.TestResult).Sortable(true);
                            columns.Add().Encoded(false).Sanitized(false).SetWidth(30).RenderValueAs(model =>
                                @<b>
                                    @Html.ActionLink("Details", "Details", new { id = model.UserId })
                                </b>);
                            columns.Add().Encoded(false).Sanitized(false).SetWidth(30).RenderValueAs(model =>
                                @<b>
                                    @Html.ActionLink("Edit", "Edit", new { id = model.UserId })
                                </b>);
                            columns.Add().Encoded(false).Sanitized(false).SetWidth(30).RenderValueAs(model =>
                                @<b>
                                    @Html.ActionLink("Delete", "Delete", new { id = model.UserId })
                                </b>);
                        }).WithPaging(10)

<p>
    @Html.ActionLink("Back to search", "Index", "AdvancedSearch")
</p>
